<?php
$username = $_GET['username'];
$password = $_GET['password'];
$repassword = $_GET['repassword'];
if ($username == ''){
    echo "请输入用户名！";
    exit(0);}
if ($password == ''){
    echo "请输入密码";
    exit(0);
}
if ($password != $repassword){
    echo "密码与确认密码应该一致";
    exit(0);
}
if($password == $repassword){
    $conn = new mysqli('localhost','root','123456','zb');
    if ($conn->connect_error){
        echo '数据库连接失败！';
        exit(0);
    }else {
        $sql = "select * from login where user = '$username'";
        $result = $conn->query($sql);
        $number = mysqli_num_rows($result);
        if ($number) {
            echo "用户名已经存在";
        } else {
            $sql_insert = "insert into login (user,pass) values('$username','$password')";
            $res_insert = $conn->query($sql_insert);
            if ($res_insert) {
                echo '注册成功';
            } else {
                echo "系统繁忙，请稍候！";
            }
        }
    }
}else{
    echo "提交未成功！";
}
?>